package com.ydw.event_;

import com.ydw.aware.MyAwareService;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

/**
 * @author HYL
 * @create 2017-07-06 下午4:19
 **/
public class TestEvent {
    public static void main(String[] args) {
        AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(EventConfig.class);
        MyAwareService publisher = context.getBean(MyAwareService.class);
        System.out.println("我开始处理我的逻辑");
        System.out.println("业务处理完毕");
        new Thread(new Runnable() {
            @Override
            public void run() {
                try {
                    Thread.sleep(10000L);
                    System.out.println("新的线程执行");
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        }).start();
//        publisher.publish("订单号:11111");
        publisher.publishEvent();
        System.out.println("已经发布监听");
    }
}
